package com.erp.gather.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.aliyun.TranslateImage;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import kotlin.collections.ArrayDeque;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

//TODO 采集相关，暂不迁移
@RestController
@RequestMapping("/gather/pictureEditor")
public class PictureEditorController {

	@GetMapping
	public R<Object> pictureEditor(String url) {
//		Object pictureEditor = PictureEditorUtils.pictureEditor(url);
		Object pictureEditor = TranslateImage.translateImage(url);
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("sourceLang", "zh");
		map.put("targetLang", "en");
		List<Object> list = new ArrayDeque<Object>();
		list.add(pictureEditor);
		map.put("templateJson", list);
		return R.ok(map);
	}

	@GetMapping("/queryFinalImage")
	public R<Object> queryFinalImage(String url) {
//		Object pictureEditor = PictureEditorUtils.pictureEditor(url);
		String picture = TranslateImage.queryFinalImage(url);
		return R.ok(picture);
	}
}
